of: Fix ABI changes
authorBen Hutchings <ben@decadent.org.uk>
Mon, 8 Dec 2014 01:10:36 +0000 (01:10 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 16 Jan 2015 00:15:12 +0000 (00:15 +0000)
'of: Fix overflow bug in string property parsing functions'
(included in 3.16.7-ckt2) and 'of: add optional options parameter to
of_find_node_by_path()' (cherry-picked to support console selection)
changed various exported functions into inline wrappers.  Change the
wrappers to exported extern functions, to maintain the ABI.

Gbp-Pq: Topic debian
Gbp-Pq: Name of-fix-abi-changes.patch

drivers/of/base.c
include/linux/of.h

index 819f4275eb5ea848c07c5b204393ed1a6a39fae9..05c429f8413915ff526ef7a29bfea687d0df3a63 100644 (file)
@@ -882,6 +882,12 @@ struct device_node *of_find_node_opts_by_path(const char *path, const char **opt
 }
 EXPORT_SYMBOL(of_find_node_opts_by_path);
 
+struct device_node *of_find_node_by_path(const char *path)
+{
+       return of_find_node_opts_by_path(path, NULL);
+}
+EXPORT_SYMBOL(of_find_node_by_path);
+
 /**
  *     of_find_node_by_name - Find a node by its "name" property
  *     @from:  The node to start searching from or NULL, the node
@@ -1460,6 +1466,51 @@ int of_property_read_string_helper(struct device_node *np, const char *propname,
 }
 EXPORT_SYMBOL_GPL(of_property_read_string_helper);
 
+/**
+ * of_property_count_strings() - Find and return the number of strings from a
+ * multiple strings property.
+ * @np:                device node from which the property value is to be read.
+ * @propname:  name of the property to be searched.
+ *
+ * Search for a property in a device tree node and retrieve the number of null
+ * terminated string contain in it. Returns the number of strings on
+ * success, -EINVAL if the property does not exist, -ENODATA if property
+ * does not have a value, and -EILSEQ if the string is not null-terminated
+ * within the length of the property data.
+ */
+int of_property_count_strings(struct device_node *np, const char *propname)
+{
+       return of_property_read_string_helper(np, propname, NULL, 0, 0);
+}
+EXPORT_SYMBOL_GPL(of_property_count_strings);
+
+/**
+ * of_property_read_string_index() - Find and read a string from a multiple
+ * strings property.
+ * @np:                device node from which the property value is to be read.
+ * @propname:  name of the property to be searched.
+ * @index:     index of the string in the list of strings
+ * @out_string:        pointer to null terminated return string, modified only if
+ *             return value is 0.
+ *
+ * Search for a property in a device tree node and retrieve a null
+ * terminated string value (pointer to data, not a copy) in the list of strings
+ * contained in that property.
+ * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if
+ * property does not have a value, and -EILSEQ if the string is not
+ * null-terminated within the length of the property data.
+ *
+ * The out_string pointer is modified only if a valid string can be decoded.
+ */
+int of_property_read_string_index(struct device_node *np,
+                                 const char *propname,
+                                 int index, const char **output)
+{
+       int rc = of_property_read_string_helper(np, propname, output, 1, index);
+       return rc < 0 ? rc : 0;
+}
+EXPORT_SYMBOL_GPL(of_property_read_string_index);
+
 void of_print_phandle_args(const char *msg, const struct of_phandle_args *args)
 {
        int i;
index c5068376b776bfe58ecae77399fe2a5e875ff5e3..6e930951a66e0eb8f125d76394eef259f76ee489 100644 (file)
@@ -230,10 +230,7 @@ extern struct device_node *of_find_matching_node_and_match(
 
 extern struct device_node *of_find_node_opts_by_path(const char *path,
        const char **opts);
-static inline struct device_node *of_find_node_by_path(const char *path)
-{
-       return of_find_node_opts_by_path(path, NULL);
-}
+extern struct device_node *of_find_node_by_path(const char *path);
 
 extern struct device_node *of_find_node_by_phandle(phandle handle);
 extern struct device_node *of_get_parent(const struct device_node *node);
@@ -273,9 +270,14 @@ extern int of_property_read_u64(const struct device_node *np,
 extern int of_property_read_string(struct device_node *np,
                                   const char *propname,
                                   const char **out_string);
+extern int of_property_read_string_index(struct device_node *np,
+                                        const char *propname,
+                                        int index, const char **output);
 extern int of_property_match_string(struct device_node *np,
                                    const char *propname,
                                    const char *string);
+extern int of_property_count_strings(struct device_node *np,
+                                    const char *propname);
 extern int of_property_read_string_helper(struct device_node *np,
                                              const char *propname,
                                              const char **out_strs, size_t sz, int index);
@@ -495,6 +497,19 @@ static inline int of_property_read_string(struct device_node *np,
        return -ENOSYS;
 }
 
+static inline int of_property_read_string_index(struct device_node *np,
+                                               const char *propname, int index,
+                                               const char **out_string)
+{
+       return -ENOSYS;
+}
+
+static inline int of_property_count_strings(struct device_node *np,
+                                           const char *propname)
+{
+       return -ENOSYS;
+}
+
 static inline int of_property_read_string_helper(struct device_node *np,
                                                 const char *propname,
                                                 const char **out_strs, size_t sz, int index)
@@ -690,50 +705,6 @@ static inline int of_property_read_string_array(struct device_node *np,
        return of_property_read_string_helper(np, propname, out_strs, sz, 0);
 }
 
-/**
- * of_property_count_strings() - Find and return the number of strings from a
- * multiple strings property.
- * @np:                device node from which the property value is to be read.
- * @propname:  name of the property to be searched.
- *
- * Search for a property in a device tree node and retrieve the number of null
- * terminated string contain in it. Returns the number of strings on
- * success, -EINVAL if the property does not exist, -ENODATA if property
- * does not have a value, and -EILSEQ if the string is not null-terminated
- * within the length of the property data.
- */
-static inline int of_property_count_strings(struct device_node *np,
-                                           const char *propname)
-{
-       return of_property_read_string_helper(np, propname, NULL, 0, 0);
-}
-
-/**
- * of_property_read_string_index() - Find and read a string from a multiple
- * strings property.
- * @np:                device node from which the property value is to be read.
- * @propname:  name of the property to be searched.
- * @index:     index of the string in the list of strings
- * @out_string:        pointer to null terminated return string, modified only if
- *             return value is 0.
- *
- * Search for a property in a device tree node and retrieve a null
- * terminated string value (pointer to data, not a copy) in the list of strings
- * contained in that property.
- * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if
- * property does not have a value, and -EILSEQ if the string is not
- * null-terminated within the length of the property data.
- *
- * The out_string pointer is modified only if a valid string can be decoded.
- */
-static inline int of_property_read_string_index(struct device_node *np,
-                                               const char *propname,
-                                               int index, const char **output)
-{
-       int rc = of_property_read_string_helper(np, propname, output, 1, index);
-       return rc < 0 ? rc : 0;
-}
-
 /**
  * of_property_read_bool - Findfrom a property
  * @np:                device node from which the property value is to be read.